/**
 * ---------------------------
 * Time: 2017/8/9 19:25.
 * Author: Cangshi
 * View: http://palerock.cn
 * ---------------------------
 */
define(['app', 'zepto'], function (app, $) {
    app.factory('failureHolder', function () {
        return {
            // 业务执行错误统一处理
            /**
             * 处理请求失败的信息
             * @param message {string|Array}
             * @param code {int}
             * @param thenDo {Function=}
             */
            handleFailure: function (message, code, thenDo) {
                if (!message) {
                    message = '错误信息为空'
                }
                if (code == null) {
                    code = -1;
                }
                $.alert('错误代码:' + code + ',' + message, thenDo);
            }
        }
    });
});